package playn.game.backgrounds;

import playn.core.Surface;
import playn.game.core.Game;

public class Sky {
	
	private static int AMOUNT_OF_POINTS=500;
	
	
	class Star {
		private int x;
		private int y;
		private int color;
		
		public Star(int x,int y,int color){
			this.x=x;
			this.y=y;
			this.color=color;
		}
		
		public void render(Surface surface){
			surface.setFillColor(color);
			surface.fillRect(x, y, 1, 1);
		}
	}
	
	private Star[] stars = new Star[AMOUNT_OF_POINTS];
	
	
	public Sky(){
		for(int i=0;i<AMOUNT_OF_POINTS;i++){
		
			int c=(byte)(Math.random()*255);
			int color=c*256*256+c*256+c;
			int x=(int)(Math.random()*Game.SCREEN_WIDTH);
			int y=(int)(Math.random()*Game.SCREEN_HEIGHT);

			stars[i]=new Star(x,y,color);
		}
	}


	public void render(Surface surface) {
		for(int i=0;i<AMOUNT_OF_POINTS;i++){
			stars[i].render(surface);
		}
	}
	
}
